<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改门店价格')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-price-edit" th:object="${priceFruitPrice}">
        <input name="pId" th:field="*{pId}" type="hidden">
        <div class="form-group">
            <label class="col-sm-3 control-label">水果编号：</label>
            <div class="col-sm-8">
                <input name="code" th:field="*{code}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">水果名称：</label>
            <div class="col-sm-8">
                <input name="name" th:field="*{name}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">最大金额：</label>
            <div class="col-sm-8">
                <input name="maxprice" th:field="*{maxprice}" class="form-control" type="text" readonly>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">零售价：</label>
            <div class="col-sm-8">
                <input name="price" th:field="*{price}" class="form-control" type="text" id="lsj" readonly>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">折扣：</label>
            <div class="col-sm-8">
<!--                <input name="zhekou" th:field="*{zhekou}" class="form-control" type="text">-->
                <select name="zhekou" th:field="*{zhekou}" id="zk" class="form-control" type="text" onblur="ZK()">
                    <option value="0">不打折</option>
                    <option value="0.1">1折</option>
                    <option value="0.2">2折</option>
                    <option value="0.3">3折</option>
                    <option value="0.4">4折</option>
                    <option value="0.5">5折</option>
                    <option value="0.79">79折</option>
                    <option value="0.88">88折</option>
                    <option value="0.95">95折</option>
                </select>
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
    var prefix = ctx + "price/price";
    $("#form-price-edit").validate({
        focusCleanup: true
    });

    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/edit", $('#form-price-edit').serialize());
        }
    }
    function ZK() {
        var zk = document.getElementById("zk").value;
        var oldlsj = document.getElementById("lsj").value;
        document.getElementById("lsj").value = oldlsj - (oldlsj * zk);


    }
</script>
</body>
</html>